package com.itheima.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingService;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * 删除过期的预约数据
 */
public class ClearOrderSetting {

    @Reference
    private OrderSettingService orderSettingService;

    public void clearOrderDate() {
        //获取到当前的日期

        try {
            Calendar calendar = Calendar.getInstance();
            Date time = calendar.getTime();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
            String format = dateFormat.format(time);
           orderSettingService.deletOrderDate(format);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }


}
